package com.web.controller;

import com.web.exception.DescribeException;
import com.web.exception.ExceptionEnum;
import com.web.exception.ExceptionHandle;
import com.web.pojo.Result;
import com.web.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 测试的控制器
 * @Author zhu_jinsheng[zhu_js@suixingpay.com]
 * @Date 2019/12/7 22:06
 * @Version 1.0
 */
@RestController
@RequestMapping(value = "/test", produces = "application/json; charset=utf-8")
public class TestController {

    @Autowired
    private ExceptionHandle exceptionHandle;

    @RequestMapping("/result")
    public Result testController(@RequestParam("name") String name, @RequestParam("pwd") String pwd){
        Result result = ResultUtil.success();
//        try {
//            if (name.equals("zzp")){
//                result =  ResultUtil.success();
//            }else if (name.equals("pzz")){
//                result =  ResultUtil.error(ExceptionEnum.USER_NOT_FIND);
//            }else{
//                int i = 1/0;
//            }
//        }catch (Exception e){
//            result =  exceptionHandle.exceptionGet(e);
//        }
        throw new DescribeException(ExceptionEnum.USER_NOT_FIND);
//        int i = 1/0;
//        return result;
    }
}
